<template>
	<div id="tmpl">
		<ul class="mui-table-view">
			<li class="mui-table-view-cell mui-media" v-for="(item,index) in list" :key="index">
				<router-link v-bind="{to:'/news/newsinfo/'+item.id}">
					<img class="mui-media-object mui-pull-left" :src="item.img_url">
					<div class="mui-media-body">
						{{item.title}}
						<p class='mui-ellipsis' v-text="item.zhaiyao"></p>
						<div class="footer">
							<span>发布时间：{{item.add_time | datefmt("YYYY-MM-DD HH:mm:ss")}}</span>
							<span class="click">阅读数：{{item.click}}</span>
						</div>
					</div>
				</router-link>
			</li>
		</ul>
	</div>
</template>

<script>
	import { Toast } from 'mint-ui';
	import common from '../../kits/common.js';
	export default {
		data(){
			return {
				list:[],
			}
		},
		created(){
			this.getNewsList();
		},
		methods:{
			getNewsList(){
				var url =  common.apidomain + '/api/getnewslist';
				this.$http.get(url).then(function (res) {
					var data = res.body;
					if(data.status !==0){
						Toast(res.message);
						return;
					}
					this.list = data.message;
				})
			}
		}
	}
</script>

<style scoped>
	.mui-table-view .mui-media-object {
		max-width: 79px;
		height: 79px;
		line-height: 79px;
	}
	.footer {
		color: #26a2ff;
		font-size: 16px;
		margin-top: 20px;
	}
	.click {
		margin-left: 30px;
	}
</style>